Other Functions

The following functions are available globally.

  • Allows to verify if error was thrown, and if it is of given type.

    Declaration

    Swift

    public func XCTAssertThrowsError<T, E: Error>(_ expression: @autoclosure () throws -> T, of error: E.Type, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line)

    Parameters

    expression

    Expression

    error

    Expected error type

    message

    Optional message

    file

    File (optional)

    line

    Line (optional)

  • Allows to verify if error was throws, and if its exactly the one expected.

    Declaration

    Swift

    public func XCTAssertThrowsError<T, E>(_ expression: @autoclosure () throws -> T, error: E, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where E: Error, E: Equatable

    Parameters

    expression

    Expression

    error

    Expected error conforming to Equatable, Error

    message

    Optional message

    file

    File (optional)

    line

    Line (optional)

  • [Internal] Fails flow with given message

    Declaration

    Swift

    public func Failure(_ message: String) -> Swift.Never

    Parameters

    message

    Failure message

    Return Value

    Never